package me.zk.practice1.s;

import java.util.TreeMap;

public class LS198 {
    public static int rob(int[] nums) {
        if (nums.length == 0) {
            return 0;
        }
        int n = nums.length;
        int[] dp = new int[n+1];
        dp[0] = 0;
        dp[1] = nums[0];
        for (int i = 2; i <=n; i++) {
            dp[i] = Math.max(dp[i-1],nums[i-1] + dp[i-2]);
            System.out.println(dp[i]);
        }
        return dp[n];
    }


    public static void main(String[] args) {
        rob(new int[]{2,23,9,3,20});
        TreeMap map = new TreeMap();

    }
}
